package com.tsu.mall.order.Controller;

import com.tsu.mall.common.VO.PersonalVO;
import com.tsu.mall.common.entity.Member;
import com.tsu.mall.common.service.IBillService;
import com.tsu.mall.common.service.IMemberService;
import com.tsu.mall.common.util.RequestUtil;
import jdk.nashorn.internal.ir.RuntimeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/personal")
public class PersonalController {
    @Autowired
    private IMemberService iMemberService;
    @Autowired
    private IBillService iBillService;
    @GetMapping("/personalPage")
    public String personalPage(Model model){
        //查询当前用户对应支付状态等一系列数量信息
        PersonalVO personal=iBillService.doSelectByStatus(RequestUtil.getCurrent().getId());
        model.addAttribute("personal",personal);
        //查询当前登录用户信息
        Member currentMember=iMemberService.doSelectById(RequestUtil.getCurrent().getId());
        model.addAttribute("currentMember",currentMember);
        return "personal";
    }
}
